import React from "react";

class Home extends React.Component {
  constructor(props) {
    super(props)
    this.state ={
      list: ["11111", "22222", '33333'],
      formData: {
        msg: '我是个点击弹窗'
      },
      msg: '这是假的'
    }
    this.getMessages=this.getMessages.bind(this)
  }
  run() {
    console.log('唱跳rap篮球')
  }
  getData() {
    alert(this.state.formData.msg)
  }
  getMessages() {
    alert(this.state.formData.msg)
  }
  jianClick=()=>{
    alert(this.state.formData.msg)
  }
  editMsg=()=>{
    this.setState({
      msg: '这不是真的把'
    })
  }

  render() {
    return (
      <div>
        <p className="red">{this.state.msg}</p>
        <p>这是Home组件</p>
        <div className="cursor" onClick={this.run}>点击我console</div>
        <hr />
        <div className="cursor" onClick={this.getData.bind(this)}>点击我会显示弹窗啊</div>
        <hr />
        <div className="cursor" onClick={this.getMessages}>点击我会messages</div>
        <hr />
        <div className="cursor" onClick={this.getMessages}>箭头函数点击展示信息内容</div>
        <hr />
        <div className="cursor" onClick={this.editMsg}>箭头函数点击展示信息内容</div>
      </div>
    )
  }
}

export default Home;